var exec = require('cordova/exec');

/**
 * options:
 *      showFrameInfo
 *      title
 *      serverIp
 *      protocol
 *      username
 *      password
 *      streamQuality
 *
 *      // VCS 格式视频参数
 *      realPlay
 *      cameraUuid
 *      channelIndex
 *
 *      // WCS 格式视频参数
 *      path
 *      nodeUid
 * handler:
 *      VIDEO_PALY
 *      VIDEO_CLOSED
 *      VIDEO_MEMORY_WARING
 *      VIDEO_ERROR
 */
exports.playVideo = function(options, handler) {
    exec(handler, null, 'VcsWsVideo', 'playVideo', [options]);
};

exports.setShowFrameInfo = function (b, success, error) {
    exec(success, error, 'VcsWsVideo', 'setShowFrameInfo', [b]);
};

// 初始化视频库
window.setTimeout(function() {
    exec(
        () => { console.log('VscWsVideo初始化成功!'); },
        () => { console.error('VscWsVideo初始化失败!'); },
        'VcsWsVideo', '_ready', []);
}, 0);
